export default {
  totalProdType: state => state.cart.list.length,
  isAllChecked: state => state.cart.list.length > 0 && state.cart.list.every(item=>item.isChecked),
  totalPrice: state => {
    let total = 0
    state.cart.list.forEach(element => {
      if (element.isChecked) {
        total += element.goods_price * element.number
      }
    });
    return total
  },
  totalProdNumber: state => {
    let total = 0
    state.cart.list.forEach(element => {
      if (element.isChecked) {
        total += element.number
      }
    });
    return total
  },
  goodsChecked: state => state.cart.list.filter(item=>item.isChecked)
}